package main

import (
	"fmt"
)


//找出数组中和为给定值的两个元素的下标，例如数组[1,3,5,8,7]，找出两个元素之和等于8的下标分别是（0，4）和（1，2）
func findTag(a [5]int, target int){
	fmt.Println("len ", len(a))
	for i := 0; i < len(a); i++{
		for j := i + 1; j < len(a); j++{
			if a[i] + a[j] == target {
				fmt.Println("i, j = ", i, j)
			}
		}
	}
}


type Student struct {
	id   int
	name string
	age  int
}

func demo(ce []Student) {
	//切片是引用传递，是可以改变值的
	ce[1].age = 999
	// ce = append(ce, student{3, "xiaowang", 56})
	// return ce
}


func main() {
	//curTimeUnix := time.Now()
	//fmt.Println(curTimeUnix)
	//timeUnix := curTimeUnix.Unix() //时间戳
	//fmt.Println(timeUnix)
	//timeUnix = timeUnix *10000000
	//fmt.Println(timeUnix)

	fmt.Println("sss", string(10))
	findTag([5]int{1,3,5,6,5}, 8)


	var ce []Student  //定义一个切片类型的结构体
	ce = []Student{
		Student{1, "xiaoming", 22},
		Student{2, "xiaozhang", 33},
	}
	fmt.Println(ce)
	demo(ce)
	fmt.Println(ce)
}
